package com.prothink.controller;

import com.prothink.entity.JsUserOrder;
import com.prothink.service.JsUserOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
/**
 * @description ：用户相关，信息，菜单
 * @author     ：baihaihang
 * @projectName ：dingdan
 * @date       ：2022/11/11 10:14
 */
@CrossOrigin
@RestController
@RequestMapping("JsUserOrder")
public class JsUserOrderController {
    @Autowired
    private JsUserOrderService jsUserOrderService;
    @RequestMapping("bai")
    public Object object(){
        return "Wed Nov 16 14:37:58 CST 2022";
    }
    @RequestMapping("selet")
    public void selet(@RequestBody Integer shopId){

    }

    @RequestMapping("getall")

    public List<JsUserOrder>getall(@RequestBody JsUserOrder jsUserOrder){

        List<JsUserOrder> jsUserOrders = jsUserOrderService.get(jsUserOrder);
        for (JsUserOrder j:jsUserOrders
             ) {
            j.setAccount(jsUserOrderService.selet(j.getUserNumber()));
        }
        System.out.println("走了");
        return jsUserOrders;
    }
    @RequestMapping("del")
    public String del(@RequestBody Integer orderNo){
       jsUserOrderService.dele(orderNo);
       return "执行成功";
    }
}
